<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-header', TEMPLATE_INCLUDEPATH)) : (include template('base/common-header', TEMPLATE_INCLUDEPATH));?>

<a href="javascript:history.back();" class="btn btn-default">返回</a>

<form action="javascript:;" id="form_search" class="form-inline" style="float: right" method="GET" data-search-ignore="page">
    <input type="text" name="order_sn" class="form-control" value="<?php  echo $_GET['order_sn'];?>" placeholder="搜索订单号">
    <input type="text" name="transaction_id" class="form-control" value="<?php  echo $_GET['transaction_id'];?>" placeholder="微信流水号">
    <?php  if($hide_search_active_title != true) { ?>
    <input type="text" name="active_title" class="form-control" value="<?php  echo $_GET['active_title'];?>" placeholder="搜索活动名称">
    <?php  } ?>
    <select name="status">
        <option value="">全部订单&emsp;</option>
        <option value="wait_pay" <?php  if($_GET['status'] == 'wait_pay') { ?>selected="selected"<?php  } ?>>等待付款&emsp;</option>
        <option value="pay_done" <?php  if($_GET['status'] == 'pay_done') { ?>selected="selected"<?php  } ?>>支付成功&emsp;</option>
    </select>
    <?php  echo tpl_form_field_daterange('cav_time',$_GET['cav_time'])?>
    <button class="btn btn-warning">搜索</button>&emsp;
    <a class="btn btn-success" style="float:right" href="<?php  echo aurl('exportExcel')?>">导出数据</a>
</form>

<form action="javascript:void(0)" method="POST" id="form">
<table class="table table-hover">
    <thead>
    <tr>
        <!-- <th>#</th> -->
        <th>订单</th>
        <th>支付</th>
        <th>报名信息</th>
        <th>推荐人</th>
        <th>状态</th>
    </tr>
    </thead>
    <tbody>
    <?php  if(is_array($list)) { foreach($list as $index => $item) { ?>
    <?php  $ref = userinfo($item['ref_openid'])?>
    <?php  $o = userinfo($item['openid'])?>
    <tr>
        <!-- <td><input type="checkbox" name="id[]" class="check-all" value="<?php  echo $item['id'];?>"></td> -->
        <td>
            <div>订单号：<?php  echo $item['order_sn'];?></div>
            <div>微信流水：<?php  echo $item['transaction_id'];?></div>
            <div>活动：<?php  echo $item['active_title'];?></div>
            <div>下单时间：<?php  echo date('Y-m-d H:i', $item['create_time'])?></div>
            <div>支付时间：<?php echo empty($item['complete_time']) ? '---' : date('Y-m-d H:i', $item['complete_time'])?></div>
        </td>
        <td>
            <div><?php  echo $item['price'];?> 元</div>
        </td>
        <td>
            <div>
                微信账号：<img src="<?php  echo tomedia($o['avatar']);?>" style="width:26px;border-radius:50%;margin-right:8px"><?php  echo $o['nickname'];?>
            </div>
            <div>姓名：<?php  echo $item['name'];?></div>
            <div>电话：<?php  echo $item['mobile'];?></div>
        </td>
        <td>
            <?php  if(!empty($item['ref_openid'])) { ?>
                <?php  $openids = explode(',', $item['ref_openid'])?>
                <?php  $openids = array_slice(array_reverse($openids), 0, 2)?>
                <?php  $ref0 = userinfo($openids['0'])?>
                <?php  $ref1 = userinfo($openids['1'])?>
                <div>直接推荐人：<img src="<?php  echo tomedia($ref0['avatar']);?>" style="width:26px;border-radius:50%;margin-right:8px"><?php  echo $ref0['nickname'];?></div>
                <?php  if(!empty($ref1)) { ?>
                <div>间接推荐人：<img src="<?php  echo tomedia($ref1['avatar']);?>" style="width:26px;border-radius:50%;margin-right:8px"><?php  echo $ref1['nickname'];?></div>
                <?php  } ?>
            <?php  } else { ?>
                无
            <?php  } ?>
        </td>
        <td>
            <div><?php  echo $_W['NS']['order_status_label'][$item['status']];?></div>
            <div><?php  echo $_W['NS']['order_cav_label'][$item['is_cav']];?></div>
        </td>
    </tr>
    <?php  } } ?>
    </tbody>
</table>
<?php  if(empty($list)) { ?> <p class="text-center">暂无数据</p> <?php  } ?>
<?php  echo $page;?>
</form>

<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-footer', TEMPLATE_INCLUDEPATH)) : (include template('base/common-footer', TEMPLATE_INCLUDEPATH));?>
<script>var we7CommonForModule = document.createElement("script");we7CommonForModule.src = '//cdn.w7.cc/we7/w7windowside.js?v=201904260003';document.body.appendChild(we7CommonForModule)
</script>